$(document).ready( function() {
    
	$('#lookbz_url_submit').live('click', shorten_url);
	
    $('#lookbz_long_url').blur(function() {
		$(this).val('');
	});
	
	$('#lookbz_short_url').click(function() {
		this.select();
	});
    
	var shorten_url = function() {
		$.getJSON("http://www.look.bz/api.php?l=" + $('#lookbz_long_url').val() + "&callback=?", function(data){
				$('#lookbz_short_url').text(data.short_url);
		});
	}
    
});